package com.glsc.ngateway.common.base.repo.mysql.gateway.platform.it;


import com.glsc.ngateway.common.base.domain.mysql.gateway.platform.it.ItApplicationDetail;
import com.glsc.ngateway.common.api.platform.dto.it.ParamSearchAppDto;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;


@Repository
public interface ItApplicationDetailRepo extends JpaRepository<ItApplicationDetail, String> {

    ItApplicationDetail findByMxId(String mxId);

    @Query(value = "select m from ItApplicationDetail m where 1=1 " +
            "and (:#{#key.mxId} is null or mxId like CONCAT('%',:#{#key.mxId},'%')) " +
            "and (:#{#key.mxName} is null or mxName like CONCAT('%',:#{#key.mxName},'%')) " +
            "order by m.insertTime desc")
    Page<ItApplicationDetail> query(Pageable pageable, ParamSearchAppDto key);
}
